UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z/QCC0au+b4caYhdTaIBAbjdDqL5jdNRV7gl1EkN4a4='
WHERE
key_id = 'd4a5900e935f64555b6b7870f141b2b54751e46b6940274f3569489991ab885a'
AND (
token = 'Z/QCC0au+b4caYhdTaIBAbjdDqL5jdNRV7gl1EkN4a4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)