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