UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nIeJc7ibSxga9FhSsKFhd3uAMRwRO/f4kSe0UhvP3bA='
WHERE
key_id = '9e14fa9eb82cab3f20f50b292d591648d6fb4e07861278c5aa76887b2d4add8a'
AND (
token = 'nIeJc7ibSxga9FhSsKFhd3uAMRwRO/f4kSe0UhvP3bA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)