UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7YDP8zRRhEKHOmKeIisoLIhLoS5kUXNtxuFdGS8Gn9w='
WHERE
key_id = '0d45784d92767d14ce595b45703c3621d718adae8f20557b881bfe37f78accd2'
AND (
token = '7YDP8zRRhEKHOmKeIisoLIhLoS5kUXNtxuFdGS8Gn9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)