UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3U50SzZgxQ23OCuWp4vunDkWlHZLH7l1nRrteVHcywA=' 
WHERE 
  key_id = '805bc36116bd3a73c72518567d461eebb643e8b8c7ab50c1cdfc9f1c46394735' 
  AND (
    token = '3U50SzZgxQ23OCuWp4vunDkWlHZLH7l1nRrteVHcywA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025