UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sMDdmXFLFrG9yYkaYWlzo9xa22BVn+QaoxgBgW8wIck=' 
WHERE 
  key_id = '7afe14308664f283215dd13e78dccf9d78ab27e41866b61a83baca77ddacbc0c' 
  AND (
    token = 'sMDdmXFLFrG9yYkaYWlzo9xa22BVn+QaoxgBgW8wIck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032