UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1r8npZ+F2UAZlHMFZGNpNd6gLbeOVQyaCEDEjRTb37s=' 
WHERE 
  key_id = '01790f88b3314b41c3fb7b16075225d68b2a12443fbb3cb8b9eb1074ec0d4f57' 
  AND (
    token = '1r8npZ+F2UAZlHMFZGNpNd6gLbeOVQyaCEDEjRTb37s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030