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