UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TloPXDdmBv2betVxn7v4j6777HpOonmstz7+4Fg4pzI=' 
WHERE 
  key_id = '53ed624c114c7e90d800fa6f04f9d27f04bcda637830e3a32da86de9f3086c90' 
  AND (
    token = 'TloPXDdmBv2betVxn7v4j6777HpOonmstz7+4Fg4pzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045