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