UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xbpUlEiiPyYF4kfofByUXvhkWNFjOqFg/vtfPobPMBs=' 
WHERE 
  key_id = '7a7d18b64baa5c395ff652f03e51f9ac940f03393397241ee5dd3c2c9cf18415' 
  AND (
    token = 'xbpUlEiiPyYF4kfofByUXvhkWNFjOqFg/vtfPobPMBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047