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