UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oUM8M5mz/rcyCSRsl+obJGTTBuq3gP4E2CCqRthseNM=' 
WHERE 
  key_id = '31e8612cc0a20c9f631db0a34ade61fe7b27fdd2ca660945ccfaa284c047a774' 
  AND (
    token = 'oUM8M5mz/rcyCSRsl+obJGTTBuq3gP4E2CCqRthseNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031