UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pLNDi9nxegaoJzE8Jsi9bRmEju1KdrN7ogDUesm2nGE='
WHERE
key_id = '494af52f6662dee0c60342f7431e77eccf3b489343936489a2a930c6f2798c1a'
AND (
token = 'pLNDi9nxegaoJzE8Jsi9bRmEju1KdrN7ogDUesm2nGE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)