UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pC4n6IYuIiwNWhol+7owOz++spkoJw3o5VZSWDMP4p4='
WHERE
key_id = '76c422923767740ea88d65605289207ca617a92f571b03e19f151566bea47f32'
AND (
token = 'pC4n6IYuIiwNWhol+7owOz++spkoJw3o5VZSWDMP4p4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)