UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QA5BO7dbYw96vD5rJ6evMQvfYVlfWhqppJAenDf5KeM=' 
WHERE 
  key_id = '46464eb43271b7eee6ab5a60ac95871f403862c6e3fc3fec9f6962f80e2b39a6' 
  AND (
    token = 'QA5BO7dbYw96vD5rJ6evMQvfYVlfWhqppJAenDf5KeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020