UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cBAyc3K3NKyxhIzpBKIAf4yhocAYJp5ryYq2l77ivUo='
WHERE
key_id = 'ed576b5341df1a5459a015100acb842f3b818ab7c0cb1206bc929653e6b06343'
AND (
token = 'cBAyc3K3NKyxhIzpBKIAf4yhocAYJp5ryYq2l77ivUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)