UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fYAd+6fkfVIERnL1Ds+JqNghFfNMs5AuMSt3hd9AGD4='
WHERE
key_id = 'c18a0dc339053431f73008de181c32e4aaa2e8924553906818ae1698b779d734'
AND (
token = 'fYAd+6fkfVIERnL1Ds+JqNghFfNMs5AuMSt3hd9AGD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)