UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CLqqcsBtTT+XndXp6xs88zC31SX8N1NL7W3nkCZl7bE='
WHERE
key_id = 'c405ac328716e8235db28f073fa9f69654770cf9f576d07d7c33231e4a4e4b50'
AND (
token = 'CLqqcsBtTT+XndXp6xs88zC31SX8N1NL7W3nkCZl7bE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)