UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'miS3SadXb0PLrdfVAfCpAsIHCoa2TWvCok48Le38fn0=' 
WHERE 
  key_id = '3f54c2d0b6834ce47def2fc0fd7148cc280c624c80fd8271a56005179186510c' 
  AND (
    token = 'miS3SadXb0PLrdfVAfCpAsIHCoa2TWvCok48Le38fn0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034