UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7Wpetv3tNX7XjhNuSxH43/a4EuO5910Vm/p9c2fRj4Y='
WHERE
key_id = '3b7cc99dcfc1496d69bd5bbaf491ce94a5bd44145278f47d8dcf134a5b3707f0'
AND (
token = '7Wpetv3tNX7XjhNuSxH43/a4EuO5910Vm/p9c2fRj4Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)