UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qZYCKVzuExJ2ICfhjTJ8Pupur0w8HPLjEq1Dt5L1F8k='
WHERE
key_id = '7912577aaf03c95740c7d4f91ae4bfb7e686f855851dc04d0ec06418761873ec'
AND (
token = 'qZYCKVzuExJ2ICfhjTJ8Pupur0w8HPLjEq1Dt5L1F8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)