UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UyvtTznj+fZV8hg1RCla4adNaVx9o6B4ceh7foCCty4='
WHERE
key_id = 'b69a1ad509b789de8a37877a6253af59f50bfe6d6ac77b973042e51a288b75b2'
AND (
token = 'UyvtTznj+fZV8hg1RCla4adNaVx9o6B4ceh7foCCty4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)