UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9UXVEy0CZ2BnlkSB8CMBsya8rXQ2xAEDY9Vv0Simucg='
WHERE
key_id = '82cabb1c90c31d0f6a3d3b13368db02fd57f85d6d1417217b7a4a29034b8bf80'
AND (
token = '9UXVEy0CZ2BnlkSB8CMBsya8rXQ2xAEDY9Vv0Simucg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)