UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YVjoyggvkUud3KOjsyjPeE4cASC97JmxhG4quRZLVyE=' 
WHERE 
  key_id = '2b1df294e1f2dd4d599c468d354a5b34a48f490e13d467e375f926fb9184b99d' 
  AND (
    token = 'YVjoyggvkUud3KOjsyjPeE4cASC97JmxhG4quRZLVyE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030