UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HdbYE/IYECrFFoKHRPnRCxfqEchk7YYBmyBLBK3mdF8='
WHERE
key_id = '7edc4805b72036e6924114487ba1cb883e6a0eb1cc65fb317c7b460f0dc11202'
AND (
token = 'HdbYE/IYECrFFoKHRPnRCxfqEchk7YYBmyBLBK3mdF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)