UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JYMfLAeedwWW30GNxvnbm2+7ex/ZPBvg9MafCezUnzg='
WHERE
key_id = 'ad5d14351b2b31327fdc24074955376ebffd882ff4ba0b8c8324a33947c65a34'
AND (
token = 'JYMfLAeedwWW30GNxvnbm2+7ex/ZPBvg9MafCezUnzg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)