UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qvVRr2qkQJw592V5ntnZGa1+FNPH1/uSWvMFw36/JNc='
WHERE
key_id = '99e08329f9f8a8c255a07e86b8204227a86d7252436e736cddcdefdbcbab9d98'
AND (
token = 'qvVRr2qkQJw592V5ntnZGa1+FNPH1/uSWvMFw36/JNc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)