UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QBDpIOcWBqPBglyAbqcURLVxRrWSBiLq7VplXL9uE64='
WHERE
key_id = 'a221a0030b940c9f00b6ac17201d98de6baee2780faaf141688ca1a62f2b6e04'
AND (
token = 'QBDpIOcWBqPBglyAbqcURLVxRrWSBiLq7VplXL9uE64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)