UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5ALoXBhVyleG6dYfAfrnwgLsziUbjZZDxV1IVsmne5k='
WHERE
key_id = '862d13d422985a3a45a27a3567653769a9e7a7439a109f899a5df14fb47517ce'
AND (
token = '5ALoXBhVyleG6dYfAfrnwgLsziUbjZZDxV1IVsmne5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)