UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cl6BFNTrwR1GJ5NpA29YuQls8ud1SRk9b/zeX1EROqI='
WHERE
key_id = 'aa0d37a3065fa48d003ace04b24ff6f2098721516c407335f65dfc5720224a67'
AND (
token = 'Cl6BFNTrwR1GJ5NpA29YuQls8ud1SRk9b/zeX1EROqI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)