UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pqZtLg45bU6KCZbuqSICHf2XTNkMJXamuLxD1GBHHTc='
WHERE
key_id = 'c89549a9169f091ad6157bea36ebac7fb8a4dba47ac00edd2773d7601b90dfce'
AND (
token = 'pqZtLg45bU6KCZbuqSICHf2XTNkMJXamuLxD1GBHHTc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)