UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gmNWTRzuEGxb/S/5ypLW3Jg6hQwL7LLwO7sddSeRHGQ='
WHERE
key_id = '4a23433f2b3c9be310b1d5687f10661cefa7d599537745be6a016cc0f8a7de65'
AND (
token = 'gmNWTRzuEGxb/S/5ypLW3Jg6hQwL7LLwO7sddSeRHGQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)