UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B3eZe1u3UiPfRk8Ze+47Qw9UVo6AiPydd4FxMfjiur4='
WHERE
key_id = 'bf3fd3763b7af65ccec4084ff76b4d3e27840021e2c2d75e8980dee9514be930'
AND (
token = 'B3eZe1u3UiPfRk8Ze+47Qw9UVo6AiPydd4FxMfjiur4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)