UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UIzJHT8fvEXuWl+DTmYXPd1DA16uQMTwIDQSFQh6Wdk='
WHERE
key_id = 'bc0efb4887ce3648cba2bd035af475a9a3a70a6ecc716adaa9095d6d56695cf6'
AND (
token = 'UIzJHT8fvEXuWl+DTmYXPd1DA16uQMTwIDQSFQh6Wdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)