UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cmc3U5zNdTsDYVx9anQwJRS0l2SqyXXaEA+5kdv5ff4=' 
WHERE 
  key_id = '3fbde10c66e498b2e26fe1694962e79a5b3d65f35009ea9c6f218a7edf8dce85' 
  AND (
    token = 'cmc3U5zNdTsDYVx9anQwJRS0l2SqyXXaEA+5kdv5ff4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023