UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xjEkRpytlISU5h4h84f110VJI4v+gKEUee1LP1lNu0g=' 
WHERE 
  key_id = '9680c77da4ea4ce8f1f1f8566215e4422d83d51415460f199660eff672290a90' 
  AND (
    token = 'xjEkRpytlISU5h4h84f110VJI4v+gKEUee1LP1lNu0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038