UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kDv/wJfDI53LxqQj5/hGzgqxHlGHNkvOKvUX8eqavHU='
WHERE
key_id = '9707ca1716855912597be64e47c10dc4a7f22f0aac881c9cfd292a96ce3486b9'
AND (
token = 'kDv/wJfDI53LxqQj5/hGzgqxHlGHNkvOKvUX8eqavHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)