UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4KzpVyiExlR0yBXRjoVR5Knhtmox7GFDDAhVOJsk3Hw='
WHERE
key_id = '36366a1291390f7e7e3ca47330184ec452ee43e73be30d251118d948eaaf5bdf'
AND (
token = '4KzpVyiExlR0yBXRjoVR5Knhtmox7GFDDAhVOJsk3Hw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)