UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hEOYiyDx0IzDJtC/smx31+e1Vhma95fEKMZ5GS1DKj8=' 
WHERE 
  key_id = '8e6f30b97084ea3724a94a29fb8a72f753c6f388684f6fabb06b9daf2f5b1424' 
  AND (
    token = 'hEOYiyDx0IzDJtC/smx31+e1Vhma95fEKMZ5GS1DKj8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018