UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fIm2uNgCywupL2Isf7aJpgRy44BeXjPf0X+k3lRaprA='
WHERE
key_id = 'cb52385bc7eada48503b3ea64f9879fe01c4a53730903cb2d06c2eb6d7380cfa'
AND (
token = 'fIm2uNgCywupL2Isf7aJpgRy44BeXjPf0X+k3lRaprA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)