UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z7xor3c1vZ/kIXU3M6tFsLaBqzDZEnnF78WDhSKInZQ=' 
WHERE 
  key_id = '65a453639b79f9a1e040f2231dc706d363050eb863b6c172697e4fba7e7b48c8' 
  AND (
    token = 'z7xor3c1vZ/kIXU3M6tFsLaBqzDZEnnF78WDhSKInZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016