UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mQ4sfYZLkHC+d1gtkKaFtZWCJe9u096TSVh+rjQfew0=' 
WHERE 
  key_id = 'd6f7b49da812b01a9eb5094d483d5fe36322bbf9e2e0d8e56c694acc434f9424' 
  AND (
    token = 'mQ4sfYZLkHC+d1gtkKaFtZWCJe9u096TSVh+rjQfew0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039