UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g+zyVWiP91OEEFm7SbH/U29e+K0Mt6/Fh8E/1h2kXog='
WHERE
key_id = 'e8223ee4a19e81aa731dcb230250343ce9f8464fea95336d907f4124fdd94794'
AND (
token = 'g+zyVWiP91OEEFm7SbH/U29e+K0Mt6/Fh8E/1h2kXog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)