UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'euSN9LXcQaS6KRRsiGEJFGBwHwQPTRxaX4AUuS4zCeI='
WHERE
key_id = '6e7fa45ad10c6f97d47dfba06e3566816dabb6e4e59ecfb2d6435196682555e5'
AND (
token = 'euSN9LXcQaS6KRRsiGEJFGBwHwQPTRxaX4AUuS4zCeI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)