UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V4kwQsxmj7FxDuGfhapKEO+lVFOw618fUAZ58uJNt3w=' 
WHERE 
  key_id = 'c63273e23036bfc2f2eb79f31e05aca1ac62066bd5a1e1e6a991759fe15e5acf' 
  AND (
    token = 'V4kwQsxmj7FxDuGfhapKEO+lVFOw618fUAZ58uJNt3w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026