UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2YTnAJJF5Bh7u0p1IZA9QrMoN0vMizZwRhscZPThYoE='
WHERE
key_id = '3149946772f9bf4cf4e009414605a904f8b2bbbccd1cbfc09a49a8d393b789e0'
AND (
token = '2YTnAJJF5Bh7u0p1IZA9QrMoN0vMizZwRhscZPThYoE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)