UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GcyagOrt3qD2J0srsuE17CHjAwrpinAmyEDu91nuYQ8='
WHERE
key_id = '7121181933c2d9f877a51defced386c73fdf3ec2c1b8fe700e7f3525c78185c4'
AND (
token = 'GcyagOrt3qD2J0srsuE17CHjAwrpinAmyEDu91nuYQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)