UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VPAK8KsfzaGYOyqgh004moGmyGawWPUIC5sKo3jPxb8=' 
WHERE 
  key_id = '677de08b16a5d33af6b44ea511cb101edb98f94b90b9af40f5e33fd10899fc98' 
  AND (
    token = 'VPAK8KsfzaGYOyqgh004moGmyGawWPUIC5sKo3jPxb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078