UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QtRz/iJxxgP9JIx/EjbEL+8AfmcuwxZQ5gOZcU7C5Gw='
WHERE
key_id = 'c398aab834888366c802f55af8316e3a9e0ee3752219a5a133d2929f17130e37'
AND (
token = 'QtRz/iJxxgP9JIx/EjbEL+8AfmcuwxZQ5gOZcU7C5Gw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)