UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4aDgDgpk73kyafvIySPWa5RbHfaEDZrGtJZSVOniWwY=' 
WHERE 
  key_id = '20fb050f72971e003d7e4e6b3c2f85378361e89cfd3a34a1a318e54b6abdfe7f' 
  AND (
    token = '4aDgDgpk73kyafvIySPWa5RbHfaEDZrGtJZSVOniWwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042