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