UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WCW71yEWpOtGCR9QI9rX/DJtFea94jVYtBNLILhcm3w='
WHERE
key_id = '3a49fab89da75a4faf584fb463df4feb10d8c49d886d4e867631e92f14a0b12a'
AND (
token = 'WCW71yEWpOtGCR9QI9rX/DJtFea94jVYtBNLILhcm3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)