UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6jpkEGFXuoSPZwF1MTy07ku+yQJfDU2GOI0iQHUMsu4=' 
WHERE 
  key_id = 'ec4e2dc422800a2c036a59bae266f22848b5e8e1bdaf04e3cd6510daca2fb781' 
  AND (
    token = '6jpkEGFXuoSPZwF1MTy07ku+yQJfDU2GOI0iQHUMsu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029