UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Nf638m1RZnRjjqNS9y4ySReZbtkeprLCceSqg2VUl4=' 
WHERE 
  key_id = 'f4e30dad27ba81076ecbc1faafb804a9ad5698a1344d1f53bd4257387a078efb' 
  AND (
    token = '1Nf638m1RZnRjjqNS9y4ySReZbtkeprLCceSqg2VUl4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032