UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qmEZprlLkXywK8LsUBz6911WibtXhhgG7ZPCwRxHcE0=' 
WHERE 
  key_id = '311de904545475bcbf64ce0af60c43d11c7dd1f8cfce72329f897cf937ce5273' 
  AND (
    token = 'qmEZprlLkXywK8LsUBz6911WibtXhhgG7ZPCwRxHcE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045