UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gwSwzMBlkJ2oyCI/45Sks6m6BOOelGrNysszUYjXE3U=' 
WHERE 
  key_id = 'de7464249b909fad1db484e30eebec63886ff4838c72cdd979884de1ee732bf5' 
  AND (
    token = 'gwSwzMBlkJ2oyCI/45Sks6m6BOOelGrNysszUYjXE3U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043